import java.util.Random;

public class T3 {
    public static void main(String[] args) {
//        long maxMemory = Runtime.getRuntime().maxMemory();
//        long totalMemory = Runtime.getRuntime().totalMemory();
//        System.out.println("-Xmx:MAX_MEMORY = " + maxMemory + "字节、" + (maxMemory)/1024/1024 + "MB");
//        System.out.println("-Xms:MAX_MEMORY = " + totalMemory + "字节、" + (totalMemory)/1024/1024 + "MB");

        // 产生Exception in thread "main" java.lang.OutOfMemoryError: Java heap space异常
        String str = "www.baidu.com";
        while (true) {
            str = str + new Random().nextInt(555) + new Random().nextInt(677);
        }

        // 产生Exception in thread "main" java.lang.OutOfMemoryError: Java heap space异常
//        byte[] bytes = new byte[40*1024*1024];
    }
}
